Research Project

An IMU Based Dairy Cow Behavior Recognition System for Health Monitoring Using Machine Learning

# Keywords : Machine Learning IoT PostgreSQL

DairyFarm&IMU

[Note] This article is just a brief intro of the research. For more detail, please refer to the full paper : Original Paper

This research was corperated with ThroughTek (TUTK) and conducted under Professor Lin,Ta-Te. In this research, we developed a dairy cow behavior recognition system to monitor dairy cows’ health status. A total of six main behaviors were classified and the results were then send to a web server for farmers to examine.

Introduction

The health care of dairy cows is essential for dairy farms to ensure milk yield. Therefore, building up a health monitoring system can significantly lower the maintenance cost and workload. With cow behavior recognition, the health status of dairy cows can be monitored.

In this research, we developed a dairy cow behavior recognition system to monitor dairy cows‘ health status. Six main behaviors were classified: lying, standing, walking, drinking, feeding and ruminating. For data collection, a 9-axis inertial measurement unit (IMU) was equipped on each cow to continuously collect raw motion data. Our IMU device would then send the raw data through the internet to our backend computer for further analysis.

To label the IMU data for dairy cow behavior recognition, four cameras with different angles were set up in the experimental dairy farm to simultaneously record videos of different cows. All behavior types were then labeled manually into the IMU data by watching the recorded video. These IMU data were then processed and used to build the behavior recognition model.

Four data processing steps were included in this research: selecting different window sizes, feature extraction, features selection, and normalization. Various model structures including SVM, Random Forest and XGBoost were also tested to yield the best model for recognizing cow behaviors. The behavior recognition results could be further analyzed for health status monitoring, such as low ruminating time or long lying time that could be utilized for estrus detection or calving.

Approaches

This research was conducted at the experimental dairy farm of National Taiwan University situated in Da'an Dist., Taipei City, Taiwan, R.O.C. A total of six healthy Holstein-Friesian cows were selected to carry our IMU device. Each cow was monitored in at least 12 continuous hours covering from day to night.

The IMU device on the cows’ necks would transmit packed data into our database. These data would then go through the window slicing steps to slice into appropriate ranges of data. The selected data would then be processed under our proposed features. Normalization of the features would be applied before they were input into the selected model. The model would finally predict the behavior of the input data. Figure 1. shows the overall system workflow. There are three specific objectives of this research:
> To determine a suitable time window size and sampling frequency.
> To design and select appropriate features.
> To select appropriate machine learning algorithms.

System workflow
Figure 1. Overall workflow of the system. This system includes four main steps: collecting data, slicing window, extracting features and classifying and producing the seven behaviors.

“Sampling frequency” refers to the rate at which the sensor data are collected and recorded by the device. “Time window size” represents the amount of time or interval for which the IMU data are collected and used to generate features that can be later used for behavior classification. Five different sampling rates and seven different time window sizes were examined in this research. As for the feature design, a total of 156 features containing both time and spectral domain were first proposed. Three different feature selection method were then applied to eliminate unnecessary features. For the determination of machine learning models, three different algorithms were applied.

Results

In this research, an IMU-based dairy cow behavior recognition system was proposed. Different sampling frequencies were tested and there was no significant difference in model performance. Thus, we suggested that 5Hz of sampling frequencies was sufficient in this task. For time window size with fixed 5Hz sampling frequency, the larger the time window size set, the higher the performance of the system we obtained. The best performance we obtained was by setting the window size to be 30 seconds. For feature design, a total of 57 features selected by three different scoring method were introduced in this task. As for the model selection, we concluded that except for SVM, both XGBoost and Random Forest may be good enough for this task.

ModelComparison
Figure 2. Comparison of the overall F1 score

Publication

[Conference Paper]
Liang, H.T., Hsu, S.W., Hsu,J.T., Tu,C.J., Chang,Y.C., Chua T.J., Lin,T.T. 2023. An IMU based dairy cow behavior recognition system for health monitoring using machine learning. 2023 ASABE Annual International Meeting. Omaha, U.S.A. https://doi.org/10.13031/aim.202300400

Want To Know More About Me ?